package com.pro.service.imple;

import com.pro.mapper.JsUserDeptMapper;
import com.pro.pojo.JsDept;
import com.pro.pojo.JsonData;
import com.pro.service.JsUserDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author 祖铭泽
 * @Date 2022/1/20/0020
 * @description 部门 用户表 业务层 实现类
 */
@Service
public class JsUserDeptServiceImple implements JsUserDeptService {
    @Autowired
    private JsUserDeptMapper jsUserDeptMapper;
    /**
     * @Author 祖铭泽
     * @Date 2022/1/20/0020
     * @description 根据用户id查询用户所在部门
     */
    @Override
    public JsonData getDeptsByUserId(Integer userId) {
        List<JsDept> deptsByUserId = jsUserDeptMapper.getDeptsByUserId(userId);
        return deptsByUserId != null ? JsonData.buildSuccess(deptsByUserId) : JsonData.buildError("获取失败");
    }
}
